from fastapi import Header, HTTPException
from fastapi import Request

async def get_token_header(x_token: str = Header(alias="x-token"),request:Request = None):
    if request and request.url.path in ["/docs","/redoc"]:
        return
    if x_token != "my_token":
        raise HTTPException(status_code=400, detail="X-Token header invalid")

async def get_query_token(token: str | None = None,request:Request = None):
    if request and request.url.path in ["/docs","/redoc"]:
        return
    if token != "token123":
        raise HTTPException(status_code=400, detail="No valid token provided")